package org.example.edusmart.service.impl;

import org.example.edusmart.dao.CourseDao;
import org.example.edusmart.dao.CourseDirectoryDao;
import org.example.edusmart.pojo.CourseDirectoryPojo;
import org.example.edusmart.pojo.CoursePojo;
import org.example.edusmart.request.TeaOrStu.CourseGradePOjo;
import org.example.edusmart.request.admin.CourseInfoPojo;
import org.example.edusmart.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseDao courseDao;

    @Autowired
    private CourseDirectoryDao courseDirectoryDao;

    @Override
    public int addCourse(CoursePojo course) {
        return courseDao.addCourse(course);
    }

    @Override
    public void insertCourseIntoTeacher(int userId, int courseId){
        courseDao.insertCourseIntoTeacher(userId, courseId);
    }

    @Override
    public Integer verifyTeaCourse(int courseId, int userId) {
        return courseDao.verifyTeaCourse(courseId, userId);
    }

    @Override
    public List<HashMap<String, Object>> getCourseList(int userId) {
        return courseDao.getCourseList(userId);
    }


    @Override
    public int uploadCourseDirectory(CourseDirectoryPojo courseDirectory) {
        return courseDirectoryDao.addCourseDirectory(courseDirectory);
    }

    @Override
    public int getUserIdByNumber(String number) {
        return courseDao.getUserIdByNumber(number);
    }

    @Override
    public void inviteStudent(int courseId, int stuId) {
        courseDao.invite(courseId, stuId);
    }

    @Override
    public List<HashMap<String, Object>> getAllCourseDirectory(int courseId) {
        return courseDirectoryDao.getCourseDirectory(courseId);
    }

    @Override
    public void exitCourse(int userId, int courseId){
        courseDao.exitCourse(userId, courseId);
    }


    @Override
    public List<HashMap<String, Object>> getUnreviewedCourse() {
        return courseDao.getUnreviewedCourse();
    }

    @Override
    public Integer auditCourseInfo(CourseInfoPojo courseInfoPojo) {
       return courseDao.auditCourseInfo(courseInfoPojo);
    }

    @Override
    public void scoreCourse(CourseGradePOjo courseGrade) {
        courseDao.scoreCourse(courseGrade);
    }

    @Override
    public String linkTeacher(int courseId) {
        return courseDao.linkTeacher(courseId);
    }

    @Override
    public List<HashMap<String, Object>> getAllStu(int courseId) {
        return courseDao.getAllStu(courseId);
    }


}
